$(function () {
    vm.loanData();
});

var vm = new Vue({
	el:'#rrapp',
	data:{
		title: null,
        infos:{infoName:'',infoTel:''}
	},
	methods: {
        loanData:function () {
            $.getJSON("/platform/oem/info",null,function (r) {
                if (r.code == 200)
                    vm.infos = r.result == null ? {infoName:'',infoTel:''}:r.result;
                else
                    alert(r.message);
            })
        },
        saveOrUpdate: function (event) {
			var urlStr = "/platform/oem/updateInfo";
            $.ajax({
                url:urlStr,
                dataType:"JSON",
                type:"POST",
                data:JSON.stringify(vm.infos),
                success:function (r) {
                    if (r.code == 200){
                        alert("操作成功");
                        vm.loanData();
                    }else
                        alert(r.message);
                },
                error:function (e) {
                    console.error("request error",e);
                    alert("请求失败");
                }
            });
		}
	}
});